-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[SandboxIR] Make some instruction constructors private #119901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This patch changes the visibility of the constructors of CatchSwitchInst ResumeInst and SwitchInst to private instead of public. This is similar to all other Sandbox IR instructions. The constructor is private to force the user go through the Context create* API. The issue was exposed by: llvm#119824
kazutakahirata
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
You can test this locally with the following command:git-clang-format --diff HEAD~1 HEAD --extensions h,cpp -- llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.h llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.cppView the diff from clang-format here.diff --git a/llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.cpp b/llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.cpp
index 9c9a30324..86dbd2171 100644
--- a/llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.cpp
+++ b/llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.cpp
@@ -479,7 +479,8 @@ Value *BottomUpVec::emitVectors() {
return NewVec;
}
-bool BottomUpVec::tryVectorize(ArrayRef<Value *> Bndl, LegalityAnalysis &Legality) {
+bool BottomUpVec::tryVectorize(ArrayRef<Value *> Bndl,
+ LegalityAnalysis &Legality) {
Change = false;
if (LLVM_UNLIKELY(BottomUpInvocationCnt++ >= StopAt &&
StopAt != StopAtDisabled))
|
You can test this locally with the following command:git-clang-format --diff HEAD~1 HEAD --extensions h,cpp -- llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SeedCollector.h llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/SeedCollection.cpp llvm/lib/Transforms/Vectorize/SandboxVectorizer/SeedCollector.cpp llvm/unittests/Transforms/Vectorize/SandboxVectorizer/SeedCollectorTest.cppView the diff from clang-format here.diff --git a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SeedCollector.h b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SeedCollector.h
index 5e09c6ab1..ec7035069 100644
--- a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SeedCollector.h
+++ b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SeedCollector.h
@@ -307,8 +307,8 @@ class SeedCollector {
}
public:
-
- LLVM_ABI SeedCollector(BasicBlock *BB, ScalarEvolution &SE, bool CollectStores, bool CollectLoads);
+ LLVM_ABI SeedCollector(BasicBlock *BB, ScalarEvolution &SE,
+ bool CollectStores, bool CollectLoads);
LLVM_ABI ~SeedCollector();
iterator_range<SeedContainer::iterator> getStoreSeeds() {
|
You can test this locally with the following command:git-clang-format --diff HEAD~1 HEAD --extensions cpp,h -- llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SeedCollector.h llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/SeedCollection.cpp llvm/lib/Transforms/Vectorize/SandboxVectorizer/SeedCollector.cpp llvm/unittests/Transforms/Vectorize/SandboxVectorizer/SeedCollectorTest.cppView the diff from clang-format here.diff --git a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SeedCollector.h b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SeedCollector.h
index 5e09c6ab1..ec7035069 100644
--- a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SeedCollector.h
+++ b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SeedCollector.h
@@ -307,8 +307,8 @@ class SeedCollector {
}
public:
-
- LLVM_ABI SeedCollector(BasicBlock *BB, ScalarEvolution &SE, bool CollectStores, bool CollectLoads);
+ LLVM_ABI SeedCollector(BasicBlock *BB, ScalarEvolution &SE,
+ bool CollectStores, bool CollectLoads);
LLVM_ABI ~SeedCollector();
iterator_range<SeedContainer::iterator> getStoreSeeds() {
|
You can test this locally with the following command:git-clang-format --diff HEAD~1 HEAD --extensions h,cpp -- llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SeedCollector.h llvm/lib/Transforms/Vectorize/SandboxVectorizer/SeedCollector.cpp llvm/unittests/Transforms/Vectorize/SandboxVectorizer/SeedCollectorTest.cppView the diff from clang-format here.diff --git a/llvm/lib/Transforms/Vectorize/SandboxVectorizer/SeedCollector.cpp b/llvm/lib/Transforms/Vectorize/SandboxVectorizer/SeedCollector.cpp
index 815dda38b..e80dc04e1 100644
--- a/llvm/lib/Transforms/Vectorize/SandboxVectorizer/SeedCollector.cpp
+++ b/llvm/lib/Transforms/Vectorize/SandboxVectorizer/SeedCollector.cpp
@@ -122,7 +122,8 @@ void SeedContainer::insert(LoadOrStoreT *LSI, bool AllowDiffTypes) {
}
// Explicit instantiations
-template LLVM_EXPORT_TEMPLATE void SeedContainer::insert<LoadInst>(LoadInst *, bool);
+template LLVM_EXPORT_TEMPLATE void SeedContainer::insert<LoadInst>(LoadInst *,
+ bool);
template LLVM_EXPORT_TEMPLATE void SeedContainer::insert<StoreInst>(StoreInst *,
bool);
|
This patch changes the visibility of the constructors of CatchSwitchInst ResumeInst and SwitchInst to private instead of public. This is similar to all other Sandbox IR instructions. The constructor is private to force the user go through the Context create* API.
The issue was exposed by: #119824